<?php echo form_open('admin/channel/editPost');?>
<div class="container_24">
<div class="grid_2" style="padding-top: 10px"><label>Chanel:</label></div>
<div class="grid_7"><?php
$options=array();
foreach($channelList as $l){
	$options[(string)($l->id)] = $l->name;
}
echo form_dropdown('channel_id',$options,$metaModel["channel_id"]);
?></div>
<div class="grid_1" style="padding-top: 10px"><label> Date</label></div>
<div class="grid_7"><input type="text" id="open_date" name="open_date"
	value="<?php echo $metaModel["open_date"];?>" readonly="readonly" /></div>
<div class="clear"></div>
</div>
<section class="title">
<h4>Result at: <?php echo $metaModel['open_date']->format("Y-m-d");?></h4>
<input type="submit" />
</section>

<section class="item">
<div class="content">
<table cellspacing="0" border="0" class="table-list">
	<tbody>

	<?php
	$itemCount=sizeof($detail);
	$colCount = 4;
	$rowCount=$itemCount%$colCount==0?$itemCount/$colCount:$itemCount/$colCount+1;
	$rowCount=intval($rowCount);
	$itemIndex=0;
	for($i=0;$i<$rowCount;$i++)
	{
		?>
		<tr>
		<?php for($j=0;$j<$colCount;$j++){
			$hasValue=$itemIndex<$itemCount;
			$prize = $hasValue?$detail[$itemIndex]->prize:"";
			$result = $hasValue?$detail[$itemIndex]->result:"";
			$itemIndex++;
			?>
			<td><?php echo $prize;?></td>
			<td style="border-right: 1px solid #DDDDDD"><?php if($hasValue){?>
			<input type="text" name="prize<?php echo $prize;?>[]"
				value="<?php echo $result;?>" /> <?php }?></td>
				<?php
		}
		?>
		</tr>
		<?php
	}
	?>
	</tbody>
</table>
</div>
</section>
	<?php echo form_close();?>
<script type="text/javascript">
$(window).load(function() {
	Channel.initEdit();
});
</script>
